package cn.gok.overview;

import javax.sql.rowset.serial.SQLOutputImpl;
import java.util.Random;
import java.util.Scanner;

public class homework {
    public static void main(String[] args) {
//        int i = 'A';
//        System.out.println((char)(23 + 97));
        random();
    }

    private static void random() {
        System.out.println("请输入一个大于6的密码长度：");
        int n = new Scanner(System.in).nextInt();
        char cs[] = new char[n];
        Random r = new Random();
        for (int i = 0; i < n; i++){
            int x = r.nextInt(3);
            switch (x){
                case 0:{
                    cs[i] = (char)(r.nextInt(26) + 97);
//                    System.out.println("第"+i+"个:"+cs[i]);
                    break;
                }
                case 1:{
                    cs[i] = (char)(r.nextInt(26) + 65);
//                    System.out.println("第"+i+"个:"+cs[i]);
                    break;
                }
                case 2:{
                    cs[i] = (char)(r.nextInt(9)+49) ;
//                    System.out.println("第"+i+"个:"+cs[i]);
                    break;
                }
            }
        }

        String str = new String(cs);
        System.out.println(str);
    }
}
